package com.itheima.job;

import com.itheima.service.db.AnalysisByDayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
//日志同步任务
@Component
public class AnalysisTask {

    @Autowired
    AnalysisByDayService analysisByDayService;

    @Scheduled(cron = "0 0/1 * * * ?")
    //TODO 上线之后改成1小时执行一次
    //@Scheduled(cron = "0 0 0/1 * * ?")
    public void syncAnalysis(){
        System.out.println("同步分析统计表开始---");
        analysisByDayService.saveOrUpdate();
        System.out.println("同步分析统计表结束---");
    }

}
